/**
 * Ensemble de function permettant la manipulation
 * d'élements de formulaire.
 */

/**
 * injection de texte dans le corps HTML de l'objet
 */
function innerHTML(id, string) {
	document.getElementById(id).innerHTML = string;
}

/**
 * positionnnement du curseur dans le champ définie
 */
function setfocus(form, field) {
	document.forms[form].elements[field].focus();
}

/**
 * définition de l'attribut action d'un formulaire
 */
function setAction(form, action) {
	document.forms[form].action = action;
}

/**
 * submit
 */
function actionSubmit(form, action) {
	$("#" + form + "Form").attr("action", action);
	$("#" + form + "Form").submit();
}

/**
 * reset
 */
function actionReset(form) {
	document.forms[form].reset();
	return false;
}

function no_accent(my_string) {
	var new_string = "";
	var pattern_accent = new Array("é", "è", "ê", "ë", "ç", "à", "â", "ä", "î",
			"ï", "ù", "ô", "ó", "ö");
	var pattern_replace_accent = new Array("e", "e", "e", "e", "c", "a", "a",
			"a", "i", "i", "u", "o", "o", "o");
	if (my_string && my_string != "") {
		new_string = preg_replace(pattern_accent, pattern_replace_accent,
				my_string);
	}
	return new_string;
}

function preg_replace(array_pattern, array_pattern_replace, my_string) {
	var new_string = String(my_string);
	for (i = 0; i < array_pattern.length; i++) {
		var reg_exp = RegExp(array_pattern[i], "gi");
		var val_to_replace = array_pattern_replace[i];
		new_string = new_string.replace(reg_exp, val_to_replace);
	}
	return new_string;
}

